package com.onlineClass.edu.init;

import com.onlineClass.edu.service.IStartPreheatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author 邓辉
 * @ClassName StartPreheatApplicationRunner
 * @date 2024-04-30 22:25
 * 用于容器启动时执行数据从db到JVM的预热
 */
@Slf4j
@Component
public class StartPreheatApplicationRunner implements ApplicationRunner {
    @Autowired
    private IStartPreheatService iStartPreheatService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("[开始执行：db数据预热到jvm。。。]");
        iStartPreheatService.initData();
        log.info("[执行完毕：db数据预热到jvm完成！！！]");
    }
}
